function toLocalTime(year,month,day,hour,min,sec)
{
	utcTime = new Date(year,month-1,day,hour,min,sec);
	offset = -utcTime.getTimezoneOffset()/60;
	localdate = new Date(utcTime.getTime() + (3600000*offset));
	return localdate.toLocaleString();
	
	//alert(formatDate(localdate,'yyyy/MM/dd HH:mm'))
	//return (localdate.getHours()+':'+localdate.getMinutes()+', '+localdate.getYear()+'/'+localdate.getMonth()+'/'+localdate.getDay())
}

function validate_required(field,alerttxt)
{
	with (field)
	{
	if (value==null||trimS(value)=="")
	  {alert(alerttxt);return false;}
	else {return true}
	}
}

function validate_submit(thisform, fields, alerttxts)
{
	with (thisform)
	{
		for (i=0; i<fields.length; i++){
					if (validate_required(fields[i],alerttxts[i])==false)
	  			{
	  				fields[i].focus();
	  				return false;
	  			}
			}
		submit();
	}
}

function trimS(S){
	return S.replace(/(^\s*)|(\s*$)/g, ""); 
}

function modifyLinks(id,prefixion,spilth) { 
	var links = document.getElementById(id).getElementsByTagName("a");
  	for(i=0; i<links.length; i++){
	  	link = links.item(i);  
	  	with(link){
	  		if(href.indexOf(prefixion)==-1){
	  			if(spilth){
	  				startInt = href.indexOf(spilth)+spilth.length
	  				href = prefixion + escape(href.subString(startInt));  
	  			}else{
	  				href = prefixion + escape(href);  
	  			}
	  		}
		}
  	}  
}